perm filename CS204.SAI[MF,DEK] blob sn#543105 filedate 1980-11-03 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin comment kludgy program to check boundary data
C00006 ENDMK
C⊗;
begin comment kludgy program to check boundary data;

require "⊂⊃⊂⊃" delimiters; "used for macros"
define # = ⊂;comment⊃; "used henceforth instead of quoted comments like this"
define nextline = ⊂('15&'12)⊃ # carriage-return and line-feed in print commands;
define thru = ⊂step 1 until⊃ # abbreviation for for clauses;
external procedure bail;

integer ichan,ochan,brchar,eof,lineno,pageno # standard variables of input system;
string inbuf,curbuf # the input buffers;
string filename,inputfile,outputfile # variables relating to file names;
string array fn[0:2] # components of file name;

procedure scanfilename # parses filename, puts parts in the fn array;
begin integer t # (0,1,2) for (name,ext,ppn);
string s # temporary storage;
integer c # current character of string;
s←filename; t←0; fn[0]←fn[1]←fn[2]←"";
while (c←lop(s)) do
	begin if c="." then t←1 else if c="[" then t←2;
	fn[t]←fn[t]&c;
	end;
end;

procedure initio # initialize input and output;
begin while true do
	begin print("Input file: "); filename←inchwl; scanfilename;
	if fn[1]=0 then fn[1]←".dat";
	inputfile←fn[0]&fn[1]&fn[2];
	open(ichan←getchan,"DSK",0,19,0,200,brchar,eof);
	lookup(ichan,inputfile,eof);
	if not eof then done;
	print("Lookup failed on file ",inputfile,"!",nextline);
	release(ichan);
	end;
setprint("cs204.tmp","F") # output goes to file only;
setbreak(1,'14,null,"INA") # input(ichan,1) will read up to and including <FF>;
setbreak(2,'12&'14,'15,"INS") # input(ichan,2) will read up to and including
	<LF> or <FF>, discarding <LF>, <FF>, and <CR>;
inbuf←""; pageno←0; brchar←'14;
end;

label quit;
integer procedure getnext;
begin integer n;
n←0;
while "0">inbuf or inbuf>"9" do
	begin n←n+1; if n>10 then go to quit;
	if inbuf≥"A" then print(inbuf);
	inbuf←input(ichan,2);
	end;
return(lop(inbuf)-"0");
end;

preload_with 1,1,0,-1,-1,-1,0,1; integer array dx[0:7];
preload_with 0,1,1,1,0,-1,-1,-1; integer array dy[0:7];
integer x,y,d;
initio;bail;
x←y←0;
while true do
	begin d←getnext;
	print('15&'12,d,": ",x,",",y);
	x←x+dx[d]; y←y+dy[d];
	end;
quit:
end